<?php
class Attach extends CF_Controller
{

	public function __construct()
	{
		parent::__construct();
		$this->load->model('attach_mdl');
	}
	
	public function index()
	{

	}
	//读取附件数据库 图片文件并以PHP格式显示
	public function pic($id = '')
	{
		$attach = $this->attach_mdl->get_by(array('id'=>$id));

		if(!$attach)
		{
			show_error('失败：找不到内容');
			exit();
		}

		header('Content-type: image/'.$attach['filetype'].''); 
		readfile('.'.$attach['location']); 
	}
}

/* End of file attach.php */
/* Location: ./application/controllers/attach.php */